package com.lrkj.back.service.impl;

import java.util.List;
import java.util.Map;

import com.lrkj.back.mapper.ZsWupinYcpFafangMapper;
import com.lrkj.back.entity.ZsWupinYcpFafang;
import com.lrkj.back.service.ZsWupinYcpFafangService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.com.cbons.mamisay.parent.db.api.DBInterface;
import cn.com.cbons.mamisay.parent.exception.DBException;
import cn.com.cbons.mamisay.parent.service.base.ParentServiceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

@Transactional
@Service
public class ZsWupinYcpFafangServiceImpl extends ParentServiceImpl<ZsWupinYcpFafang> implements ZsWupinYcpFafangService {
    @Autowired
    private ZsWupinYcpFafangMapper yicipinfafangMapper;

    @Override
    protected DBInterface<ZsWupinYcpFafang> getDao() throws DBException {
        return yicipinfafangMapper;
    }

    // 下面这个是个错的
    @Override
    public PageInfo<ZsWupinYcpFafang> findAllfafangwuping(Map<String, Object> map) throws DBException {
        return yicipinfafangMapper.findAllYicipinDetail(map);
    }

    @Override
    public List<ZsWupinYcpFafang> findAllyicipin(Map<String, Object> map) throws DBException {
        // TODO Auto-generated method stub
        return yicipinfafangMapper.findAllYicipin(map);
    }

    @Override
    public void deleteByffls(String fafangLiushui) throws DBException {
        // TODO Auto-generated method stub
        yicipinfafangMapper.deleteByffls(fafangLiushui);
    }

    @Override
    public PageInfo<ZsWupinYcpFafang> findAllYicipinNo(Map<String, Object> map) throws DBException {
        PageHelper.startPage(Integer.valueOf(map.get("pageNo").toString()),
                Integer.valueOf(map.get("pageSize").toString()));
        List<ZsWupinYcpFafang> tbList = yicipinfafangMapper.findAllYicipin(map);
        PageInfo<ZsWupinYcpFafang> page = new PageInfo<ZsWupinYcpFafang>(tbList);
        return page;
    }

    @Override
    public int insertBatch(List<ZsWupinYcpFafang> ycpFafangs) throws DBException {
        return yicipinfafangMapper.insertBatch(ycpFafangs);
    }
}